apiVersion: batch/v1
kind: CronJob
metadata:
  name: mdapi
spec:
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1
  concurrencyPolicy: Forbid
  schedule: "20 * * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            parent: "cronjobmdapi"
        spec:
          containers:
          - name: mdapi
            image: image-registry.openshift-image-registry.svc:5000/mdapi/mdapi:latest
            command: ["bash", "-c", "/code/mdapi-get_repo_md /etc/mdapi/mdapi.cfg"]
            volumeMounts:
            - name: config-volume
              mountPath: /etc/mdapi
              readOnly: true
            - name: data-volume
              mountPath: /var/tmp
            - name: fedora-messaging-config-volume
              mountPath: /etc/fedora-messaging/
              readOnly: true
            - name: fedora-messaging-ca-volume
              mountPath: /etc/pki/rabbitmq/ca
              readOnly: true
            - name: fedora-messaging-key-volume
              mountPath: /etc/pki/rabbitmq/key
              readOnly: true
            - name: fedora-messaging-crt-volume
              mountPath: /etc/pki/rabbitmq/crt
              readOnly: true
          restartPolicy: Never
          volumes:
          - name: config-volume
            configMap:
                defaultMode: 420
                name: mdapi-configmap
          - name: data-volume
            persistentVolumeClaim:
                claimName: mdapi-storage
          - name: fedora-messaging-config-volume
            configMap:
              name: fedora-messaging-configmap
          - name: fedora-messaging-ca-volume
            secret:
                secretName: mdapi-fedora-messaging-ca
          - name: fedora-messaging-key-volume
            secret:
                secretName: mdapi-fedora-messaging-key
          - name: fedora-messaging-crt-volume
            secret:
                secretName: mdapi-fedora-messaging-crt
